package checker;

import java.io.IOException;
import java.util.TreeSet;

public class DicoTreeSet extends Dictionary {
	
	TreeSet<String> treeset = new TreeSet<String>();
	
	/**
	 * @param s The path of the dictionary file
	 */
	public DicoTreeSet(String s) {
		super(s);
		try {
			while (!(super.reader.eof())) {
				this.treeset.add(super.reader.read());
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public DicoTreeSet() {
		this("dicts/newdico"+index+".jsc");
	}

	/* (non-Javadoc)
	 * @see checker.Dictionary#contains(java.lang.String)
	 */
	public boolean contains(String s) {
		return this.treeset.contains(s);
	}
	
	/* (non-Javadoc)
	 * @see checker.Dictionary#addWord(java.lang.String)
	 */
	public void addWord(String s) {
		this.treeset.add(s);
		super.addWord(s);
	}



}
